import CryptoJS from 'crypto-js';

const password = '1';
const isopen = true;
class Crypto {
  // 加密
  encrypt(value) {
    if (isopen) {
      return CryptoJS.AES.encrypt(value, password).toString();
    } else {
      return value;
    }
  }
  //解密
  decrypt(value) {
    if (isopen) {
      return CryptoJS.AES.decrypt(value, password).toString(CryptoJS.enc.Utf8);
    } else {
      return value;
    }
  }
}

export default new Crypto();
